<script>
  init({
    title: 'Query Params Type',
    desc: 'Use `queryParamsType` option to send the difference query params.',
    links: ['bootstrap-table.min.css'],
    scripts: ['bootstrap-table.min.js']
  })
</script>

<div class="toolbar">
  <div class="radio">
    <label>
      <input type="radio" checked name="queryParamsType">
      <code>limit</code>
    </label>
  </div>
  <div class="radio">
    <label>
      <input type="radio" name="queryParamsType">
      <code>''</code>
    </label>
  </div>
</div>

<table
  id="table"
  data-toggle="table"
  data-height="460"
  data-search="true"
  data-pagination="true"
  data-side-pagination="server"
  data-query-params="queryParams"
  data-url="https://examples.wenzhixin.net.cn/examples/bootstrap_table/data">
  <thead>
    <tr>
      <th data-field="id" data-sortable="true">ID</th>
      <th data-field="name" data-sortable="true">Item Name</th>
      <th data-field="price" data-sortable="true">Item Price</th>
    </tr>
  </thead>
</table>

<script>
  var $table = $('#table')

  function queryParams(params) {
    alert('queryParams: ' + JSON.stringify(params))
    return params
  }

  function mounted() {
    $('.toolbar input').change(function () {
      var queryParamsType = $('.toolbar input:checked').next().text()

      $table.bootstrapTable('refreshOptions', {
        queryParamsType: queryParamsType
      })
    })
  }
</script>
